package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.annotation.AutoFill;
import com.sky.entity.Dish;
import com.sky.entity.DishFlavor;
import com.sky.enumeration.OperationType;
import com.sky.vo.DishVO;
import org.apache.ibatis.annotations.*;

import java.util.List;

//@Mapper
public interface DishMapper {

    DishVO selectDishById(Long id);

    @AutoFill(OperationType.UPDATE)
    void updateDish(Dish dish);

    @AutoFill(OperationType.INSERT)
    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into dish values (null,#{name},#{categoryId},#{price},#{image},#{description},#{status},#{createTime},#{updateTime},#{createUser},#{updateUser})")
    void insertDish(Dish dish);

    List<Dish> selectDishByCategoryId(Integer categoryId);

    @Delete("delete from dish where id=#{id}")
    void deleteDish(Long id);

    Page<DishVO> pageSelectDish(DishVO dishvo);
}
